package com.yumeko.demo.controller;

import com.yumeko.demo.service.IDemoService;
import com.yumeko.mvc.annotations.Autowired;
import com.yumeko.mvc.annotations.Controller;
import com.yumeko.mvc.annotations.RequestMapping;
import com.yumeko.mvc.annotations.Security;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/demo")
public class DemoController {


    @Autowired
    private IDemoService demoService;

    /**
     * URL: /demo/handle01?name=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @Security(value = "zhenghao1")
    @RequestMapping("/handle01")
    public String handle01(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);
    }
    /**
     * URL: /demo/handle02?name=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @Security(value = {"zhenghao1","zhenghao2"})
    @RequestMapping("/handle02")
    public String handle02(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);
    }
    /**
     * URL: /demo/handle03?name=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @Security(value = {"zhenghao1","zhenghao2","zhenghao3"})
    @RequestMapping("/handle03")
    public String handle03(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);
    }
}
